# -*- coding: utf-8 -*-
import os
from flask_script import Manager
from flask_migrate import MigrateCommand, Migrate
from adminApp import create_app, db, init_admin_user


app=create_app(os.getenv('FLASK_ENV', 'default'))
# app=create_app('development')
migrate = Migrate(app, db)
manager = Manager(app)
manager.add_command('db', MigrateCommand)


@manager.command
def init_admin():
    '''初始化管理员'''
    print('初始化管理员')
    init_admin_user(app)
    print('初始化管理员完毕')

if __name__ == "__main__":
    manager.run()